#!/bin/sh

# Slackware build script for Atari OS ROMs

# Written by B. Watson (yalhcru@gmail.com)

PRGNAM=atari800_roms
VERSION=${VERSION:-1} # these really don't have a version number...
ARCH=noarch  # (heh, I can't put m6502 for $ARCH...)
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT \
	$PKG/usr/share/atari800/$PRGNAM $PKG/usr/share/atari800/disks
cd $TMP
rm -rf $PRGNAM
mkdir $PRGNAM
cd $PRGNAM
unzip -LL $CWD/xf25.zip
mv *.rom $PKG/usr/share/atari800/$PRGNAM
mv *.atr *.xfd $PKG/usr/share/atari800/disks

for rom in ataribas atariosb atarixl; do
	( cd $PKG/usr/share/atari800 && ln -s $PRGNAM/$rom.rom $rom.rom )
done

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $CWD/README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
